/*
 * Decompiled with CFR 0.150.
 * 
 * Could not load the following classes:
 *  cn.hutool.core.collection.CollUtil
 *  cn.hutool.core.date.DateUtil
 *  cn.hutool.core.util.StrUtil
 *  com.alibaba.fastjson.JSON
 *  de.felixroske.jfxsupport.FXMLController
 *  javafx.fxml.FXML
 *  javafx.fxml.FXMLLoader
 *  javafx.fxml.Initializable
 *  javafx.scene.Parent
 *  javafx.scene.Scene
 *  javafx.scene.control.Alert
 *  javafx.scene.control.Alert$AlertType
 *  javafx.scene.control.ScrollPane
 *  javafx.scene.control.TextField
 *  javafx.scene.layout.VBox
 *  javafx.stage.Stage
 */
package com.gys.controller.rechargecard;

import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSON;
import com.gys.common.business.RechargeCardUtil;
import com.gys.common.data.HttpJson;
import com.gys.common.util.CacheUtil;
import com.gys.common.util.SpringUtil;
import com.gys.controller.BaseController;
import com.gys.controller.rechargecard.MemberCardQueryController;
import com.gys.data.enumclass.RechargeCardStatus;
import com.gys.data.enumclass.Sex;
import com.gys.data.example.GetLoginStoreOutData;
import com.gys.data.rechargecard.GaiaSdRechargeCardChangeInData;
import com.gys.data.rechargecard.RechargeCardInData;
import com.gys.data.rechargecard.RechargeCardOutData;
import de.felixroske.jfxsupport.FXMLController;
import java.io.IOException;
import java.net.URL;
import java.util.Collection;
import java.util.Date;
import java.util.List;
import java.util.ResourceBundle;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.fxml.Initializable;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.Alert;
import javafx.scene.control.ScrollPane;
import javafx.scene.control.TextField;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;

@FXMLController
public class RechargeCardExchangeController
extends BaseController
implements Initializable {
    @FXML
    private ScrollPane scrollPane;
    @FXML
    private VBox vBox;
    @FXML
    private TextField nameQuery;
    @FXML
    private TextField mobileQuery;
    @FXML
    private TextField cardNoQuery;
    @FXML
    private TextField name;
    @FXML
    private TextField sex;
    @FXML
    private TextField mobile;
    @FXML
    private TextField tel;
    @FXML
    private TextField amt;
    @FXML
    private TextField status;
    @FXML
    private TextField cardNo;
    @FXML
    private TextField exchangeBrName;
    @FXML
    private TextField exchangeDate;
    @FXML
    private TextField exchangeTime;
    @FXML
    private TextField exchangeOldCardNo;
    @FXML
    private TextField exchangeNewCardNo;
    @FXML
    private TextField changeRemark;
    private Stage stg;
    private boolean isForward;

    public void initialize(URL location, ResourceBundle resources) {
        this.scrollPane.setPrefWidth(this.getContentWidth());
        this.scrollPane.setPrefHeight(this.getContentHeight());
        this.vBox.setPrefWidth(this.getContentWidth());
        this.vBox.setPrefHeight(this.getContentHeight());
        this.exchangeBrName.setText(((GetLoginStoreOutData)CacheUtil.get("store")).getStoName());
        this.initDateTime();
    }

    private void initDateTime() {
        Date now = new Date();
        String date = DateUtil.format((Date)now, (String)"yyyyMMdd");
        String time = DateUtil.format((Date)now, (String)"HHmmss");
        this.exchangeDate.setText(date);
        this.exchangeTime.setText(time);
    }

    @FXML
    void queryCardInfo() {
        RechargeCardInData inData = new RechargeCardInData();
        inData.setGsrcId(this.cardNoQuery.getText());
        inData.setGsrcName(this.nameQuery.getText());
        inData.setGsrcMobile(this.mobileQuery.getText());
        Alert alert = this.createAlert(Alert.AlertType.INFORMATION, "\u63d0\u793a\u4fe1\u606f", null);
        if (StrUtil.isBlank((CharSequence)inData.getGsrcId()) && StrUtil.isBlank((CharSequence)inData.getGsrcName()) && StrUtil.isBlank((CharSequence)inData.getGsrcMobile())) {
            alert.setContentText("\u5fc5\u987b\u81f3\u5c11\u586b\u5199\u4e00\u9879\u5185\u5bb9\u8fdb\u884c\u67e5\u8be2\uff01");
            alert.showAndWait();
            return;
        }
        HttpJson rsp = RechargeCardUtil.getCardInfo(inData);
        if (rsp.isSuccess()) {
            this.exchangeNewCardNo.setText("");
            this.changeRemark.setText("");
            List dataList = JSON.parseArray((String)rsp.getMsg(), RechargeCardOutData.class);
            if (CollUtil.isEmpty((Collection)dataList)) {
                this.name.setText("");
                this.sex.setText("");
                this.mobile.setText("");
                this.tel.setText("");
                this.amt.setText("");
                this.status.setText("");
                this.cardNo.setText("");
                this.exchangeOldCardNo.setText("");
                alert.setContentText("\u672a\u67e5\u8be2\u5230\u76f8\u5173\u50a8\u503c\u5361");
                alert.showAndWait();
                return;
            }
            RechargeCardOutData outData = (RechargeCardOutData)dataList.get(0);
            this.cardNo.setText(outData.getGsrcId());
            this.name.setText(outData.getGsrcName());
            this.mobile.setText(outData.getGsrcMobile());
            this.tel.setText(outData.getGsrcTel());
            this.amt.setText(StrUtil.toString(outData.getGsrcAmt()));
            this.sex.setText(Sex.getName(outData.getGsrcSex()));
            this.status.setText(RechargeCardStatus.getName(outData.getGsrcStatus()));
            this.exchangeOldCardNo.setText(outData.getGsrcId());
        } else {
            alert.setContentText(rsp.getMsg());
            alert.showAndWait();
        }
    }

    @FXML
    void resetPassword() {
        Alert alert = this.createAlert(Alert.AlertType.INFORMATION, "\u63d0\u793a\u4fe1\u606f", null);
        if (StrUtil.isBlank((CharSequence)this.cardNo.getText())) {
            alert.setContentText("\u8bf7\u5148\u67e5\u8be2\u50a8\u503c\u5361");
            alert.showAndWait();
            return;
        }
        RechargeCardInData inData = new RechargeCardInData();
        inData.setGsrcId(this.cardNo.getText());
        HttpJson rsp = RechargeCardUtil.resetPassword(inData);
        if (rsp.isSuccess()) {
            alert.setContentText("\u50a8\u503c\u5361\u5df2\u6210\u529f\u6062\u590d\u521d\u59cb\u5bc6\u7801");
            alert.showAndWait();
        } else {
            alert.setContentText(rsp.getMsg());
            alert.showAndWait();
        }
    }

    @FXML
    void toModifyPassword() throws IOException {
        Alert alert = this.createAlert(Alert.AlertType.INFORMATION, "\u63d0\u793a\u4fe1\u606f", null);
        if (StrUtil.isBlank((CharSequence)this.cardNo.getText())) {
            alert.setContentText("\u8bf7\u5148\u67e5\u8be2\u50a8\u503c\u5361");
            alert.showAndWait();
            return;
        }
        this.isForward = true;
        Parent target = (Parent)FXMLLoader.load((URL)this.getClass().getResource("/fxml/rechargecard/passwordmodify.fxml"));
        Scene scene = new Scene(target);
        this.stg = new Stage();
        this.stg.setScene(scene);
        this.stg.show();
    }

    @FXML
    public void generateCardCode() {
        Alert alert = this.createAlert(Alert.AlertType.INFORMATION, "\u63d0\u793a\u4fe1\u606f", null);
        if (StrUtil.isBlank((CharSequence)this.cardNo.getText())) {
            alert.setContentText("\u8bf7\u5148\u67e5\u8be2\u50a8\u503c\u5361");
            alert.showAndWait();
            return;
        }
        HttpJson rsp = RechargeCardUtil.generateCardCode();
        if (rsp.isSuccess()) {
            this.exchangeNewCardNo.setText(rsp.getMsg());
            alert.setContentText("\u50a8\u503c\u5361\u53f7\u751f\u6210\u6210\u529f");
            alert.showAndWait();
        } else {
            alert.setContentText(rsp.getMsg());
            alert.showAndWait();
        }
    }

    @FXML
    private void changeCard() {
        Alert alert = this.createAlert(Alert.AlertType.INFORMATION, "\u63d0\u793a\u4fe1\u606f", null);
        if (StrUtil.isBlank((CharSequence)this.cardNo.getText())) {
            alert.setContentText("\u8bf7\u5148\u67e5\u8be2\u50a8\u503c\u5361");
            alert.showAndWait();
            return;
        }
        if (StrUtil.isBlank((CharSequence)this.exchangeNewCardNo.getText())) {
            alert.setContentText("\u8bf7\u751f\u6210\u65b0\u50a8\u503c\u5361\u53f7");
            alert.showAndWait();
            return;
        }
        if (StrUtil.isNotBlank((CharSequence)this.changeRemark.getText()) && this.changeRemark.getText().length() > 30) {
            alert.setContentText("\u5907\u6ce8\u957f\u5ea6\u4e0d\u8d85\u8fc730\u4f4d");
            alert.showAndWait();
            return;
        }
        GaiaSdRechargeCardChangeInData inData = new GaiaSdRechargeCardChangeInData();
        inData.setGsrccDate(this.exchangeDate.getText());
        inData.setGsrccTime(this.exchangeTime.getText());
        inData.setGsrccOldCardId(this.exchangeOldCardNo.getText());
        inData.setGsrccNewCardId(this.exchangeNewCardNo.getText());
        inData.setGsrccRemark(this.changeRemark.getText());
        HttpJson rsp = RechargeCardUtil.changeCard(inData);
        if (rsp.isSuccess()) {
            alert.setContentText("\u50a8\u503c\u5361\u5df2\u6362\u5361\u6210\u529f");
            alert.showAndWait();
        } else {
            alert.setContentText(rsp.getMsg());
            alert.showAndWait();
        }
    }

    @FXML
    public void toUseMemberCard() throws IOException {
        Alert alert = this.createAlert(Alert.AlertType.INFORMATION, "\u63d0\u793a\u4fe1\u606f", null);
        if (StrUtil.isBlank((CharSequence)this.cardNo.getText())) {
            alert.setContentText("\u8bf7\u5148\u67e5\u8be2\u50a8\u503c\u5361");
            alert.showAndWait();
            return;
        }
        this.isForward = true;
        MemberCardQueryController controller = (MemberCardQueryController)SpringUtil.getBean("memberCardQueryController");
        Parent target = (Parent)FXMLLoader.load((URL)this.getClass().getResource("/fxml/rechargecard/membercardquery.fxml"));
        Scene scene = new Scene(target);
        this.stg = new Stage();
        this.stg.setScene(scene);
        this.stg.show();
    }

    public ScrollPane getScrollPane() {
        return this.scrollPane;
    }

    public VBox getVBox() {
        return this.vBox;
    }

    public TextField getNameQuery() {
        return this.nameQuery;
    }

    public TextField getMobileQuery() {
        return this.mobileQuery;
    }

    public TextField getCardNoQuery() {
        return this.cardNoQuery;
    }

    public TextField getName() {
        return this.name;
    }

    public TextField getSex() {
        return this.sex;
    }

    public TextField getMobile() {
        return this.mobile;
    }

    public TextField getTel() {
        return this.tel;
    }

    public TextField getAmt() {
        return this.amt;
    }

    public TextField getStatus() {
        return this.status;
    }

    public TextField getCardNo() {
        return this.cardNo;
    }

    public TextField getExchangeBrName() {
        return this.exchangeBrName;
    }

    public TextField getExchangeDate() {
        return this.exchangeDate;
    }

    public TextField getExchangeTime() {
        return this.exchangeTime;
    }

    public TextField getExchangeOldCardNo() {
        return this.exchangeOldCardNo;
    }

    public TextField getExchangeNewCardNo() {
        return this.exchangeNewCardNo;
    }

    public TextField getChangeRemark() {
        return this.changeRemark;
    }

    public Stage getStg() {
        return this.stg;
    }

    public boolean isForward() {
        return this.isForward;
    }

    public void setScrollPane(ScrollPane scrollPane) {
        this.scrollPane = scrollPane;
    }

    public void setVBox(VBox vBox) {
        this.vBox = vBox;
    }

    public void setNameQuery(TextField nameQuery) {
        this.nameQuery = nameQuery;
    }

    public void setMobileQuery(TextField mobileQuery) {
        this.mobileQuery = mobileQuery;
    }

    public void setCardNoQuery(TextField cardNoQuery) {
        this.cardNoQuery = cardNoQuery;
    }

    public void setName(TextField name) {
        this.name = name;
    }

    public void setSex(TextField sex) {
        this.sex = sex;
    }

    public void setMobile(TextField mobile) {
        this.mobile = mobile;
    }

    public void setTel(TextField tel) {
        this.tel = tel;
    }

    public void setAmt(TextField amt) {
        this.amt = amt;
    }

    public void setStatus(TextField status) {
        this.status = status;
    }

    public void setCardNo(TextField cardNo) {
        this.cardNo = cardNo;
    }

    public void setExchangeBrName(TextField exchangeBrName) {
        this.exchangeBrName = exchangeBrName;
    }

    public void setExchangeDate(TextField exchangeDate) {
        this.exchangeDate = exchangeDate;
    }

    public void setExchangeTime(TextField exchangeTime) {
        this.exchangeTime = exchangeTime;
    }

    public void setExchangeOldCardNo(TextField exchangeOldCardNo) {
        this.exchangeOldCardNo = exchangeOldCardNo;
    }

    public void setExchangeNewCardNo(TextField exchangeNewCardNo) {
        this.exchangeNewCardNo = exchangeNewCardNo;
    }

    public void setChangeRemark(TextField changeRemark) {
        this.changeRemark = changeRemark;
    }

    public void setStg(Stage stg) {
        this.stg = stg;
    }

    public void setForward(boolean isForward) {
        this.isForward = isForward;
    }

    public boolean equals(Object o) {
        if (o == this) {
            return true;
        }
        if (!(o instanceof RechargeCardExchangeController)) {
            return false;
        }
        RechargeCardExchangeController other = (RechargeCardExchangeController)o;
        if (!other.canEqual(this)) {
            return false;
        }
        ScrollPane this$scrollPane = this.getScrollPane();
        ScrollPane other$scrollPane = other.getScrollPane();
        if (this$scrollPane == null ? other$scrollPane != null : !this$scrollPane.equals(other$scrollPane)) {
            return false;
        }
        VBox this$vBox = this.getVBox();
        VBox other$vBox = other.getVBox();
        if (this$vBox == null ? other$vBox != null : !this$vBox.equals(other$vBox)) {
            return false;
        }
        TextField this$nameQuery = this.getNameQuery();
        TextField other$nameQuery = other.getNameQuery();
        if (this$nameQuery == null ? other$nameQuery != null : !this$nameQuery.equals(other$nameQuery)) {
            return false;
        }
        TextField this$mobileQuery = this.getMobileQuery();
        TextField other$mobileQuery = other.getMobileQuery();
        if (this$mobileQuery == null ? other$mobileQuery != null : !this$mobileQuery.equals(other$mobileQuery)) {
            return false;
        }
        TextField this$cardNoQuery = this.getCardNoQuery();
        TextField other$cardNoQuery = other.getCardNoQuery();
        if (this$cardNoQuery == null ? other$cardNoQuery != null : !this$cardNoQuery.equals(other$cardNoQuery)) {
            return false;
        }
        TextField this$name = this.getName();
        TextField other$name = other.getName();
        if (this$name == null ? other$name != null : !this$name.equals(other$name)) {
            return false;
        }
        TextField this$sex = this.getSex();
        TextField other$sex = other.getSex();
        if (this$sex == null ? other$sex != null : !this$sex.equals(other$sex)) {
            return false;
        }
        TextField this$mobile = this.getMobile();
        TextField other$mobile = other.getMobile();
        if (this$mobile == null ? other$mobile != null : !this$mobile.equals(other$mobile)) {
            return false;
        }
        TextField this$tel = this.getTel();
        TextField other$tel = other.getTel();
        if (this$tel == null ? other$tel != null : !this$tel.equals(other$tel)) {
            return false;
        }
        TextField this$amt = this.getAmt();
        TextField other$amt = other.getAmt();
        if (this$amt == null ? other$amt != null : !this$amt.equals(other$amt)) {
            return false;
        }
        TextField this$status = this.getStatus();
        TextField other$status = other.getStatus();
        if (this$status == null ? other$status != null : !this$status.equals(other$status)) {
            return false;
        }
        TextField this$cardNo = this.getCardNo();
        TextField other$cardNo = other.getCardNo();
        if (this$cardNo == null ? other$cardNo != null : !this$cardNo.equals(other$cardNo)) {
            return false;
        }
        TextField this$exchangeBrName = this.getExchangeBrName();
        TextField other$exchangeBrName = other.getExchangeBrName();
        if (this$exchangeBrName == null ? other$exchangeBrName != null : !this$exchangeBrName.equals(other$exchangeBrName)) {
            return false;
        }
        TextField this$exchangeDate = this.getExchangeDate();
        TextField other$exchangeDate = other.getExchangeDate();
        if (this$exchangeDate == null ? other$exchangeDate != null : !this$exchangeDate.equals(other$exchangeDate)) {
            return false;
        }
        TextField this$exchangeTime = this.getExchangeTime();
        TextField other$exchangeTime = other.getExchangeTime();
        if (this$exchangeTime == null ? other$exchangeTime != null : !this$exchangeTime.equals(other$exchangeTime)) {
            return false;
        }
        TextField this$exchangeOldCardNo = this.getExchangeOldCardNo();
        TextField other$exchangeOldCardNo = other.getExchangeOldCardNo();
        if (this$exchangeOldCardNo == null ? other$exchangeOldCardNo != null : !this$exchangeOldCardNo.equals(other$exchangeOldCardNo)) {
            return false;
        }
        TextField this$exchangeNewCardNo = this.getExchangeNewCardNo();
        TextField other$exchangeNewCardNo = other.getExchangeNewCardNo();
        if (this$exchangeNewCardNo == null ? other$exchangeNewCardNo != null : !this$exchangeNewCardNo.equals(other$exchangeNewCardNo)) {
            return false;
        }
        TextField this$changeRemark = this.getChangeRemark();
        TextField other$changeRemark = other.getChangeRemark();
        if (this$changeRemark == null ? other$changeRemark != null : !this$changeRemark.equals(other$changeRemark)) {
            return false;
        }
        Stage this$stg = this.getStg();
        Stage other$stg = other.getStg();
        if (this$stg == null ? other$stg != null : !this$stg.equals(other$stg)) {
            return false;
        }
        return this.isForward() == other.isForward();
    }

    protected boolean canEqual(Object other) {
        return other instanceof RechargeCardExchangeController;
    }

    public int hashCode() {
        int PRIME = 59;
        int result = 1;
        ScrollPane $scrollPane = this.getScrollPane();
        result = result * 59 + ($scrollPane == null ? 43 : $scrollPane.hashCode());
        VBox $vBox = this.getVBox();
        result = result * 59 + ($vBox == null ? 43 : $vBox.hashCode());
        TextField $nameQuery = this.getNameQuery();
        result = result * 59 + ($nameQuery == null ? 43 : $nameQuery.hashCode());
        TextField $mobileQuery = this.getMobileQuery();
        result = result * 59 + ($mobileQuery == null ? 43 : $mobileQuery.hashCode());
        TextField $cardNoQuery = this.getCardNoQuery();
        result = result * 59 + ($cardNoQuery == null ? 43 : $cardNoQuery.hashCode());
        TextField $name = this.getName();
        result = result * 59 + ($name == null ? 43 : $name.hashCode());
        TextField $sex = this.getSex();
        result = result * 59 + ($sex == null ? 43 : $sex.hashCode());
        TextField $mobile = this.getMobile();
        result = result * 59 + ($mobile == null ? 43 : $mobile.hashCode());
        TextField $tel = this.getTel();
        result = result * 59 + ($tel == null ? 43 : $tel.hashCode());
        TextField $amt = this.getAmt();
        result = result * 59 + ($amt == null ? 43 : $amt.hashCode());
        TextField $status = this.getStatus();
        result = result * 59 + ($status == null ? 43 : $status.hashCode());
        TextField $cardNo = this.getCardNo();
        result = result * 59 + ($cardNo == null ? 43 : $cardNo.hashCode());
        TextField $exchangeBrName = this.getExchangeBrName();
        result = result * 59 + ($exchangeBrName == null ? 43 : $exchangeBrName.hashCode());
        TextField $exchangeDate = this.getExchangeDate();
        result = result * 59 + ($exchangeDate == null ? 43 : $exchangeDate.hashCode());
        TextField $exchangeTime = this.getExchangeTime();
        result = result * 59 + ($exchangeTime == null ? 43 : $exchangeTime.hashCode());
        TextField $exchangeOldCardNo = this.getExchangeOldCardNo();
        result = result * 59 + ($exchangeOldCardNo == null ? 43 : $exchangeOldCardNo.hashCode());
        TextField $exchangeNewCardNo = this.getExchangeNewCardNo();
        result = result * 59 + ($exchangeNewCardNo == null ? 43 : $exchangeNewCardNo.hashCode());
        TextField $changeRemark = this.getChangeRemark();
        result = result * 59 + ($changeRemark == null ? 43 : $changeRemark.hashCode());
        Stage $stg = this.getStg();
        result = result * 59 + ($stg == null ? 43 : $stg.hashCode());
        result = result * 59 + (this.isForward() ? 79 : 97);
        return result;
    }

    public String toString() {
        return "RechargeCardExchangeController(scrollPane=" + this.getScrollPane() + ", vBox=" + this.getVBox() + ", nameQuery=" + this.getNameQuery() + ", mobileQuery=" + this.getMobileQuery() + ", cardNoQuery=" + this.getCardNoQuery() + ", name=" + this.getName() + ", sex=" + this.getSex() + ", mobile=" + this.getMobile() + ", tel=" + this.getTel() + ", amt=" + this.getAmt() + ", status=" + this.getStatus() + ", cardNo=" + this.getCardNo() + ", exchangeBrName=" + this.getExchangeBrName() + ", exchangeDate=" + this.getExchangeDate() + ", exchangeTime=" + this.getExchangeTime() + ", exchangeOldCardNo=" + this.getExchangeOldCardNo() + ", exchangeNewCardNo=" + this.getExchangeNewCardNo() + ", changeRemark=" + this.getChangeRemark() + ", stg=" + this.getStg() + ", isForward=" + this.isForward() + ")";
    }
}

